import request from '@/utils/axios'

export type SmsLogType = {
  id: number | null
  channelId: number | null
  channelCode: string
  templateId: number | null
  templateCode: string
  templateType: number
  templateContent: string
  templateParams: string
  apiTemplateId: string
  mobile: string
  userId: number | null
  userType: number | null
  sendStatus: number
  sendTime: Date | null
  apiSendCode: string
  apiSendMsg: string
  apiRequestId: string
  apiSerialNo: string
  receiveStatus: number
  receiveTime: Date | null
  apiReceiveCode: string
  apiReceiveMsg: string
  create_time?: string
}

export interface SmsLogPageReqType extends PageParam {
  mobile?: string
  channelId?: number
  templateId?: number
  sendStatus?: number
  sendTime?: Date[]
  receiveStatus?: number
  receiveTime?: Date[]
}

/**
 * 消息中心 - 短信管理 - 短信日志接口
 */
export const SmsLogApi = {
  // 查询分页列表
  page: (params: SmsLogPageReqType) => {
    return request.get({ url: '/system/sms-log/page', params, is_mock: true })
  },
  // 导出短信日志
  export: (params: SmsLogPageReqType) => {
    return request.get({ url: '/system/sms-log/export', params, is_mock: true })
  }
}
